﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FoodManager
{
    public partial class frBaoCaoSoChe : Form
    {
        public frBaoCaoSoChe()
        {
            InitializeComponent();
        }

        private void btnThongKe_Click(object sender, EventArgs e)
        {
            dbTableAdapters.tblSoCheTableAdapter da = new dbTableAdapters.tblSoCheTableAdapter();
            da.FillByDate(db1.tblSoChe, new DateTime(dtTuNgay.Value.Year, dtTuNgay.Value.Month, dtTuNgay.Value.Day), new DateTime(dtDenNgay.Value.Year, dtDenNgay.Value.Month, dtDenNgay.Value.Day));
            gridControl1.DataSource = db1.tblSoChe;
        }

        private void btnXuatExcel_Click(object sender, EventArgs e)
        {
            SaveFileDialog d = new SaveFileDialog();
            d.FileName = "bao cao so che.xlsx";
            d.Filter = "Excel2007|*.xlsx|All files (*.*)|*.*";
            if (d.ShowDialog() == DialogResult.OK)
            {
                gridControl1.ExportToXlsx(d.FileName);
            }
        }
    }
}
